import static java.lang.Math.pow;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2024-03-02
 * Time:10:27
 */
public class Solution {
    public int getSum(int a, int b) {
        while (b != 0) {
            int tmp1 = a & b;
            a ^= b;
            b = tmp1 << 1;
        }
        return a;
    }

    public static int[] missingTwo(int[] nums) {
        int len = nums.length;
        int sum = 0;
        for(int num:nums) {
            sum ^= num;
        }
        for(int i = 1;i <= len+2;i++) {
            sum ^= i;
        }
        int k = 0;
        for(int i = 0;i < 32;i++) {
            if(((sum >> i) & 1) == 1) {
                k = i;
                break;
            }
        }
        int[] ret = new int[2];
        for(int num:nums) {
            if(((num >> k) & 1) == 1) ret[0] ^= num;
            else ret[1] ^= num;
        }
        for(int i = 1;i <= len+2;i++) {
            if(((i >> k) & 1) == 1) ret[0] ^= i;
            else ret[1] ^= i;
        }
        return ret;
    }

    public static void main(String[] args) {
        int[] arr = {2};
    }
}
